home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
089a.dms
/
089a.adf
/
TEXTS
/
CHAPTERS_21-30
/
Chapter22.txt
< prev
next >
Wrap
Text File
|
1992-03-06
|
2KB
|
47 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter Twenty Two
-------------------
I hope you succeeded in solving the project I set you in chapter 21.
In case you didn't or would like to check out my solution here it is:
REM Example22.Amos (A possible solution)
Hide On
Unpack 10 To 3
Repeat
If Jleft(1) Then Shift Up 1,1,31,1
If Jright(1) Then Shift Down 1,1,31,1
If Fire(1) Then Shift Off
Until Mouse Key
Default
Edit
First I loaded the starfield routine in Example21.Amos. and edited the code
to appear as above.
After unpacking the screen from bank 10 we hit a brand new command
structure, REPEAT. This is only half of a command really as it's called a
REPEAT UNTIL loop. It's just like a DO LOOP structure, remember that? What
REPEAT UNTIL does is it REPEATedly executes the instructions between the
REPEAT and the UNTIL commands. The UNTIL needs a condition attached to it.
In this case I have decided that the code will be REPEATed UNTIL a MOUSE KEY
has been pressed. I could have put UNTIL INKEY$<>"" (any key press) or
UNTIL JUP(1) (joystick pushed up) etc.
So basically, Amos will be looping between the REPEAT UNTIL instructions
until either a MOUSE KEY is pressed or the JRIGHT, JLEFT or FIRE functions
are true. If the joystick is pushed to the left we set the SHIFT UP
instruction in action which starts the stars moving.
The opposite applies for JRIGHT. I have also added the FIRE button to the
loop which stops the stars in their tracks. Not bad for a few lines!
I think we have spent long enough on the SHIFT instruction, fun though it is.
Please feel free to experiment further, there are lots of tricks that can be
done. So get out Dpaint and see what you can do.
End of Chapter 22
^^^^^^^^^^^^^^^^^